{% extends "base.html" %}
{% load staticfiles %}

{% block page_content %}
<section class="content-header" style="padding-top:0px" xmlns="http://www.w3.org/1999/html">
<div class="row">
    <div class="box box-info">
        <div class="box-header">
            <h2>Custom Detector {{ object.name }} trained using {{ object.algorithm }} with {{ object.boxes_count }} boxes on {{ object.frames_count }} images </h2>
        </div>
    </div>
</div>
</section>



<section class="content">
    <div class="row">
        <div class="col-md-6">
            <div class="box box-primary">
            <div class="box-header with-border"><h3>Arguments</h3></div>
            <div class="box-body">
                <textarea class="form-control" readonly="readonly"  rows="10">{{ object.arguments }}</textarea>
            </div>
            <div class="box-footer">
                <a href="{{ MEDIA_URL }}exports/{{ object.pk }}.dva_detector.zip" class="btn btn-primary" ><i class="fa fa-download"></i> Download trained model</a>
            </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="box box-primary">
            <div class="box-header with-border"><h3>Class distribution</h3></div>
            <div class="box-body">
                <table class="table dataTables-dict">
                    <thead>
                        <tr>
                            <th>Object</th>
                            <th>Count</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for k,v in class_distribution %}
                            <tr>
                                <td>{{ k }}</td>
                                <td class="text-right">{{ v }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="box box-primary">
            <div class="box-header with-border"><h3>Phase 1 loss</h3></div>
            <div class="box-body">
                <table class="table dataTables-dict">
                    <thead>
                        <tr>
                            <th>Epoch</th>
                            <th>Train loss</th>
                            <th>Validation loss loss</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for k in phase_1_log %}
                            <tr>
                                <td class="text-center">{{ k.0 }}</td>
                                <td class="text-right">{{ k.1 }}</td>
                                <td class="text-right">{{ k.2 }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="box box-primary">
            <div class="box-header with-border"><h3>Phase 2 loss</h3></div>
            <div class="box-body">
                    <table class="table dataTables-dict">
                    <thead>
                        <tr>
                            <th>Epoch</th>
                            <th>Train loss</th>
                            <th>Validation loss loss</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for k in phase_2_log %}
                            <tr>
                                <td class="text-center">{{ k.0 }}</td>
                                <td class="text-right">{{ k.1 }}</td>
                                <td class="text-right">{{ k.2 }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}
{% block page_js%}
<script>
    $(document).ready(function() {
        InitializeTables();
    })
</script>
{% endblock %}
